package com.bcxj.apipassenger.Service;

import com.bcxj.apipassenger.remote.ServicePriceClient;
import com.bcxj.internalcommon.dto.ForecastPriceDTO;
import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.internalcommon.response.ForecastPriceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: ForecastPriceService
 * Package: com.bcxj.apipassenger.Service
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/10/5 14:14
 * @Version 1.0
 * @Since 1.0
 */
@Service
public class ForecastPriceService {

    @Autowired
    private ServicePriceClient servicePriceClient;


    /**
     * 预估价格
     * @param depLongitude 源经度
     * @param depLatitude 源纬度
     * @param destLongitude 目的经度
     * @param destLatitude 目的纬度
     * @return
     */
    public ResponseResult getForecastPrice(String depLongitude, String depLatitude, String destLongitude, String destLatitude, String cityCode, String vehicleType) {
        // 0 封装信息
        ForecastPriceDTO forecastPriceDTOBuilder = ForecastPriceDTO.builder().depLatitude(depLatitude).depLongitude(depLongitude).destLatitude(destLatitude).destLongitude(destLongitude)
                .cityCode(cityCode).vehicleType(vehicleType).build();

        // 1. 调用service-price服务获取预估的价格
        ResponseResult<ForecastPriceResponse> responseResult = servicePriceClient.forecastPrice(forecastPriceDTOBuilder);

        // 2. 返回预测价格
        return responseResult;
    }

}
